package com.cd.system.jpa.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.persistence.PostPersist;
import javax.persistence.PostRemove;
import javax.persistence.PostUpdate;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;

public class TestEntityListener {

    private static final Logger logger = LoggerFactory.getLogger(TestEntityListener.class);

    @PrePersist
    public void PrePersist(Object entity) {
        logger.debug("进行insert之前");
    }

    @PostPersist
    public void PostPersist(Object entity) {
        logger.debug("进行insert之后");
    }

    @PreUpdate
    public void PreUpdate(Object entity) {
        logger.debug("进行update之前");
    }

    @PostUpdate
    public void PostUpdate(Object entity) {
        logger.debug("进行update之后");
    }

    @PostRemove
    public void PostRemove(Object entity) {
        logger.debug("进行delete之后");
    }
}
